import request from '@/utils/request'

// 查询订单列表
export function exCodeList(query) {
  return request({
    url: '/system/exCode/get/listForPage',
    method: 'get',
    params: query
  })
}

// 获取兑换功能开关状态
export function exCodeConfigStatus() {
  return request({
    url: '/system/exCode/get/configStatus',
    method: 'get'
  })
}

// 更新兑换功能状态
export function updateExCodeConfigStatus(data) {
  return request({
    url: '/system/exCode/update/' + data,
    method: 'post'
  })
}

// 生成兑换码
export function addExchangeCode(data) {
  return request({
    url: '/system/exCode/add/exchangeCode',
    method: 'post',
    data
  })
}

// 查看兑换码
export function getExchangeCode(id) {
  return request({
    url: '/system/exCode/get/' + id,
    method: 'get'
  })
}

// 删除兑换码
export function delExCode(id) {
  return request({
    url: '/system/exCode/remove/' + id,
    method: 'delete'
  })
}

// 启用、禁用兑换码
export function exchangeCodeStatus({status, id}) {
  return request({
    url: `/system/exCode/update/${status}/by/${id}`,
    method: 'post'
  })
}



